package com.lost.octopus.test.es7demo.exception;



/**
 * 业务异常响应代码的枚举类，在此统一定义异常代码
 */
public enum Es7DemoResponseCode implements ResponseCode {
    ACCOUNT_EXISTS(1901, "已经存在此登录账号");

    private int code;
    private String message;

    Es7DemoResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public int getCode() {
        return this.code;
    }

    @Override
    public String getMessage() {
        return this.message;
    }

    public RuntimeException exception() {
        return new RuntimeException(String.format("code: %d, message: %s", getCode(), getMessage()));
    }

}
